<div class="panel panel-default">
    <div class="panel-heading">

        <form class="search-form form-inline">
            <div class="form-group">
                <label>
                    <a>文章管理</a>
                    &nbsp;>>
                    <a>编辑文章</a></label>
            </div>
            &nbsp;</form>

    </div>
    <div class="panel-body">
        <div class="table-responsive">
            <form class="submit-form">
                <div class="form-group">
                    <label for="title">标题</label>
                    <input type="text" name="title" class="form-control" id="title" value="{$info.title}" placeholder="请输入标题">
                </div>
                <div class="form-group">
                    <label for="cate_id">文章分类</label>
                    <select name="cate_id" id="cate_id" class="form-control">
                        {foreach $parentCateList as $k => $v}
                        <option {if $info['cate_id'] == $v['id']}selected{/if} value="{$v.id}" >
                            {$v.cate_name}
                        </option>
                        {/foreach}
                    </select>
                    <p class="help-block">顶级分类无需选择</p>
                </div>
                <div class="form-group">
                    <label >封面图片</label>

                    <span class="btn btn-info" style="display: block;width: fit-content;">
                        <span>选择图片</span>
                        <span style="opacity: 0;display:inline-block;position: absolute;left: 0;">
                            <input class="file-uploader"  type="file" data-path="cover_pic" data-uploadimg="uploadimg" data-progress="cover_pic_progress" name="file" id="file" name="cover_pic" >
                        </span>

                    </span>

                </div>
                <div class="form-group">
                    <div class="progress" style="display: none">
                        <div class="progress-bar" s id="cover_pic_progress" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
                            0%
                        </div>
                    </div>
                    <img id="uploadimg" src="{$info.cover_pic}" style="width: 200px;height:auto;"/>
                    <input class="upload-file-path" type="hidden" name="cover_pic" id="cover_pic" value="{$info.cover_pic}">
                </div>

                <div class="form-group">
                    <label for="article_sort">排序</label>
                    <input type="text" class="form-control" name="article_sort" id="article_sort" placeholder="请输入0~127之间数值，数值越大排序越前" value="{$info.article_sort}">
                    <p class="help-block">请输入0~127之间数值，数值越大排序越前</p>
                </div>
                <div class="form-group">
                    {$info.content}

                    <script id="container" name="content" type="text/plain">
                        {$info.content}
                    </script>
                </div>
                <input type="hidden" name="act" value="{:url($act)}">
                <input type="hidden" name="req_sub" value="1">
                <input type="hidden" name="id" value="{$info.id}">

                <button type="submit" class="ajax-btn btn btn-info">保存</button>
            </form>
        </div>
    </div>
</div>
<!-- 配置文件 -->
<script type="text/javascript" src="__STATIC__/plugins/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__STATIC__/plugins/ueditor/ueditor.all.js"></script>

<script src="__STATIC__/plugins/uploader/js/vendor/jquery.ui.widget.js"></script>
<script src="__STATIC__/plugins/uploader/js/jquery.iframe-transport.js"></script>
<script src="__STATIC__/plugins/uploader/js/jquery.fileupload.js"></script>
<script>

    $(function () {
        window.UEDITOR_HOME_URL = '../../static/plugins/ueditor/';
        var editor = UE.getEditor('container',{UEDITOR_HOME_URL:'../../static/plugins/ueditor/',serverUrl:'../../static/plugins/ueditor/php/controller.php',initialFrameHeight:400});

        $('.file-uploader').fileupload({
            dataType: 'json',
            url: "{:url('admin/index/upload',['path'=>'article'])}",//文件的后台接受地址
            //设置进度条
            progressall: function (e, data) {
                var progress = parseInt(data.loaded / data.total * 100);
                $('#'+$(e.target).data('progress')).show();
                $('#'+$(e.target).data('progress')).css('width',progress + '%');
                $('#'+$(e.target).data('progress')).html(progress + '%');

            },
            //上传完成之后的操作，显示在img里面
            done: function (e, data){
                var target = $(e.target).data();
                $('#'+target.uploadimg).attr({src: data.result.data.url});
                $('#'+target.uploadimg).css({display: "block"});
                $('#'+target.path).val(data.result.data.url);
            }

        });

    });
</script>